﻿using Prism.Commands;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace demo.ViewModel
{
    public class MainViewModel: BindableBase
    {
      


        private ObservableCollection<Person> _personList = new ObservableCollection<Person>();
        /// <summary>
        ///账户列表
        /// </summary>
        public ObservableCollection<Person> PersonList
        {
            get { return _personList; }
            set { SetProperty(ref _personList, value); }
        }

        private Person _selectChange;
        public Person SelectChange {
            get { return _selectChange; }
            set { SetProperty(ref _selectChange, value); }
        }



        public MainViewModel()
        {
            PersonList = new ObservableCollection<Person>();
            PersonList.Add(new Person { Name = "张三" });
            PersonList.Add(new Person { Name = "李四" });
            PersonList.Add(new Person { Name = "王五" });


            SelectChange= new Person { Name = "z323" };

            PersonList.Add(SelectChange);


            UpdateCommand = new DelegateCommand(() => {

                PersonList.Clear();
            });
         
        }

        public DelegateCommand UpdateCommand { get; set; }
       
    }







    public class Person: BindableBase
    {
        private string name;
        /// <summary>
        ///账户列表
        /// </summary>
        public string Name
        {
            get { return name; }
            set { SetProperty(ref name, value); }
        }
    }





}
